package UnitTest.DataStructureTest.arrayAndListTest.findValueTest;

import Top100.GetMostValueofOrderArray;
import DataStructure.arrayAndList.findValue.GetMostValueofOrderArrayImpl_recursion;
import DataStructure.arrayAndList.findValue.GetMostValueofOrderArrayImpl;
import org.junit.Test;

/**
 * @author liujun
 * @version 1.0
 * @date 2020/8/20
 * @author—Email ljfirst@mail.ustc.edu.cn
 * @blogURL https://blog.csdn.net/ljfirst
 * @description 测试案例
 * 一个有序数组，比如[1,2,3,4,5,6,7],
 * 后面部分被替换到前面，比如[5,6,7,1,2,3,4],找出替换后的数组的给定值
 */
public class GetTargetValueofOrderArrayTest extends GetMostValueofOrderArrayTestData {

    @Test
    public void testgetMin_recursion() {
        test(new GetMostValueofOrderArrayImpl_recursion());
    }

    @Test
    public void testgetMin() {
        test(new GetMostValueofOrderArrayImpl());
    }


    public void test(GetMostValueofOrderArray find) {

        int value = find.getTargetValue(demoarray12, target12);
        assert value == 0;

        value = find.getTargetValue(demoarray01, target01);
        assert value == target01Index;
        value = find.getTargetValue(demoarray011, target011);
        assert value == target011Index;
        // 测试案例不行
        /*value = find.getTargetValue(demoarray012, target012);
        assert value == target012Index;*/
        value = find.getTargetValue(demoarray02, target02);
        assert value == target02Index;
        value = find.getTargetValue(demoarray03, target03);
        assert value == target03Index;
        value = find.getTargetValue(demoarray04, target04);
        assert value == target04Index;
        value = find.getTargetValue(demoarray05, target05);
        assert value == target05Index;
        value = find.getTargetValue(demoarray06, target06);
        assert value == target06Index;
        value = find.getTargetValue(demoarray07, target07);
        assert value == target07Index;

        value = find.getTargetValue(demoarray08, target08);
        assert value == target08Index;
        value = find.getTargetValue(demoarray081, target081);
        assert value == target081Index;
        /*value = find.getTargetValue(demoarray082, target082);
        assert value == target082Index;*/
        /*value = find.getTargetValue(demoarray083, target083);
        assert value == target083Index;*/
        value = find.getTargetValue(demoarray084, target084);
        assert value == target084Index;

        value = find.getTargetValue(demoarray09, target09);
        assert value == target09Index;
        value = find.getTargetValue(demoarray10, target10);
        assert value == target10Index;

        value = find.getTargetValue(demoarray11, target11);
        assert value == target11Index;


    }
}
